﻿using System;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using _2323._5._5无聊;
namespace 序列化
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            Circle circle1 = new Circle(2);
            Circle circle2 = new Circle(3);
            test2 test = new test2();
            circle2.print();
            string path = @"C:\Users\86198\Desktop\tset.txt";
            using (FileStream p = new FileStream(path, FileMode.OpenOrCreate, FileAccess.Read))
            {
                BinaryFormatter source = new BinaryFormatter();
                circle2 =(Circle)source.Deserialize(p);

                

                

            }
            circle1.print();
            circle2.print();

        }
        [Serializable]
        class test2
        {
            public int age = 0;
            public string name = "132";
            public void x(int c)
            {
                age = c;
            }
        }
    }
}
